var logistStoreCtrl  = new XFApp.client();
$.views.converters({
	
});

XFApp.client.prototype.logistStore = {
		successCode : "10000",	
		urlItems : {			
			saveStoreURL: basePath+"/userCenter/logisticsRecord/saveStore",
		},
		
		formValidate : function(){
			$("#editForm").validate({
		        rules: {
		        	storageCode: "required",
		        	storageName: "required"
				  },
				 messages: {
					storageCode: "请填写仓库编码",
					storageName: "请填写仓库名称"		        	
				  }
		    });
			$("#editForm").validate();
		},
		
		event : function (){			
			_this = this;
			
			$("#submitBtn").on("click",function(){				
				if($("#editForm").validate().form()){
					logistStoreCtrl.logistStore.save();
				}				
			});
			//表单验证
			_this.formValidate();	
		},		
		
		save : function(){
			
			var entity = {
			    logisticsId : $("#logistId").val(),
				storageCode : $("#storageCode").val(),
				storageName : $("#storageName").val()	
			}
	    	
	    	$.ajax({
	    		url :_this.urlItems.saveStoreURL,
	    		data : entity,
	    		dataType : "json",
	    		type : 'post',
	    		success : function(data) {				
	    			if(data.code==_this.successCode){ 
	    				window.webDialogUtil.alert("提示",data.msg);	  				
	    				$('#editForm')[0].reset();
	    			}else{
	    				window.webDialogUtil.alert("提示",data.msg);
	    			}
	    		}
	    	});	
		},
		
},

$(function(){	
	logistStoreCtrl.logistStore.event();
	
});